import java.io.FileWriter;
import java.io.IOException;

public class UserApiGenerator {

    public static void main(String[] args) {
        generateRegisterRequest();
        generateLoginRequest();
        generateRegisterResponse();
        generateLoginResponse();
        generateUserData();
    }

    private static void generateRegisterRequest() {
        String code = "package com.example.mydy;\n\n" +
                "public class RegisterRequest {\n" +
                "    private String username;\n" +
                "    private String password;\n\n" +
                "    public RegisterRequest(String username, String password) {\n" +
                "        this.username = username;\n" +
                "        this.password = password;\n" +
                "    }\n\n" +
                "    public String getUsername() {\n" +
                "        return username;\n" +
                "    }\n\n" +
                "    public void setUsername(String username) {\n" +
                "        this.username = username;\n" +
                "    }\n\n" +
                "    public String getPassword() {\n" +
                "        return password;\n" +
                "    }\n\n" +
                "    public void setPassword(String password) {\n" +
                "        this.password = password;\n" +
                "    }\n" +
                "}";
        writeToFile("RegisterRequest.java", code);
    }

    private static void generateLoginRequest() {
        String code = "package com.example.mydy;\n\n" +
                "public class LoginRequest {\n" +
                "    private String username;\n" +
                "    private String password;\n\n" +
                "    public LoginRequest(String username, String password) {\n" +
                "        this.username = username;\n" +
                "        this.password = password;\n" +
                "    }\n\n" +
                "    public String getUsername() {\n" +
                "        return username;\n" +
                "    }\n\n" +
                "    public void setUsername(String username) {\n" +
                "        this.username = username;\n" +
                "    }\n\n" +
                "    public String getPassword() {\n" +
                "        return password;\n" +
                "    }\n\n" +
                "    public void setPassword(String password) {\n" +
                "        this.password = password;\n" +
                "    }\n" +
                "}";
        writeToFile("LoginRequest.java", code);
    }

    private static void generateRegisterResponse() {
        String code = "package com.example.mydy;\n\n" +
                "public class RegisterResponse {\n" +
                "    private String message;\n\n" +
                "    public String getMessage() {\n" +
                "        return message;\n" +
                "    }\n\n" +
                "    public void setMessage(String message) {\n" +
                "        this.message = message;\n" +
                "    }\n" +
                "}";
        writeToFile("RegisterResponse.java", code);
    }

    private static void generateLoginResponse() {
        String code = "package com.example.mydy;\n\n" +
                "public class LoginResponse {\n" +
                "    private boolean success;\n" +
                "    private String message;\n" +
                "    private String username;\n" +
                "    private String balance;\n" +
                "    private String level;\n\n" +
                "    public boolean isSuccess() {\n" +
                "        return success;\n" +
                "    }\n\n" +
                "    public void setSuccess(boolean success) {\n" +
                "        this.success = success;\n" +
                "    }\n\n" +
                "    public String getMessage() {\n" +
                "        return message;\n" +
                "    }\n\n" +
                "    public void setMessage(String message) {\n" +
                "        this.message = message;\n" +
                "    }\n\n" +
                "    public String getUsername() {\n" +
                "        return username;\n" +
                "    }\n\n" +
                "    public void setUsername(String username) {\n" +
                "        this.username = username;\n" +
                "    }\n\n" +
                "    public String getBalance() {\n" +
                "        return balance;\n" +
                "    }\n\n" +
                "    public void setBalance(String balance) {\n" +
                "        this.balance = balance;\n" +
                "    }\n\n" +
                "    public String getLevel() {\n" +
                "        return level;\n" +
                "    }\n\n" +
                "    public void setLevel(String level) {\n" +
                "        this.level = level;\n" +
                "    }\n" +
                "}";
        writeToFile("LoginResponse.java", code);
    }

    private static void generateUserData() {
        String code = "package com.example.mydy;\n\n" +
                "public class UserData {\n" +
                "    private int inviteCount;\n" +
                "    private double taskRewardToday;\n" +
                "    private double subTaskReward;\n" +
                "    private double userBalance;\n" +
                "    private String level;\n\n" +
                "    public int getInviteCount() {\n" +
                "        return inviteCount;\n" +
                "    }\n\n" +
                "    public void setInviteCount(int inviteCount) {\n" +
                "        this.inviteCount = inviteCount;\n" +
                "    }\n\n" +
                "    public double getTaskRewardToday() {\n" +
                "        return taskRewardToday;\n" +
                "    }\n\n" +
                "    public void setTaskRewardToday(double taskRewardToday) {\n" +
                "        this.taskRewardToday = taskRewardToday;\n" +
                "    }\n\n" +
                "    public double getSubTaskReward() {\n" +
                "        return subTaskReward;\n" +
                "    }\n\n" +
                "    public void setSubTaskReward(double subTaskReward) {\n" +
                "        this.subTaskReward = subTaskReward;\n" +
                "    }\n\n" +
                "    public double getUserBalance() {\n" +
                "        return userBalance;\n" +
                "    }\n\n" +
                "    public void setUserBalance(double userBalance) {\n" +
                "        this.userBalance = userBalance;\n" +
                "    }\n\n" +
                "    public String getLevel() {\n" +
                "        return level;\n" +
                "    }\n\n" +
                "    public void setLevel(String level) {\n" +
                "        this.level = level;\n" +
                "    }\n" +
                "}";
        writeToFile("UserData.java", code);
    }

    private static void writeToFile(String fileName, String code) {
        try (FileWriter writer = new FileWriter(fileName)) {
            writer.write(code);
            System.out.println("Generated " + fileName);
        } catch (IOException e) {
            System.err.println("Error generating " + fileName + ": " + e.getMessage());
        }
    }
}